import { reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { useValidator } from '@/hooks/web/useValidator'
import { FormSchema } from '@/types/form'
const { t } = useI18n()
const { required } = useValidator()
// form
export const schema = reactive<FormSchema[]>([
  {
    field: 'departName',
    label: t('depForm.departName'),
    component: 'Input',
    colProps: { span: 24 },
    formItemProps: {
      rules: [required()]
    }
  },
  {
    field: 'parentId',
    label: t('depForm.parentId'),
    component: 'TreeSelect',
    colProps: { span: 24 },
    componentProps: {
      disabled: true,
      placeholder: ' ',
      options: [
        {
          label: 'option1',
          value: '1'
        },
        {
          label: 'option2',
          value: '2'
        }
      ]
    }
  },
  {
    field: 'orgCode',
    label: t('depForm.orgCode'),
    component: 'Input',
    colProps: { span: 24 },
    componentProps: {
      placeholder: ' ',
      disabled: true
    },
    formItemProps: {
      rules: [required()]
    }
  },
  {
    field: 'orgCategory',
    label: t('depForm.orgCategory'),
    component: 'Radio',
    colProps: { span: 24 },
    componentProps: {
      options: [
        { label: '公司', value: '1' }
        // { label: '部门', value: '2' },
        // { label: '岗位', value: '3' }
      ]
    }
  },
  {
    field: 'departOrder',
    label: t('depForm.departOrder'),
    component: 'InputNumber',
    colProps: { span: 24 },
    componentProps: {
      controlsPosition: 'right'
    }
  },
  {
    field: 'mobile',
    label: t('depForm.mobile'),
    colProps: { span: 24 },
    component: 'Input'
  },
  {
    field: 'address',
    label: t('depForm.address'),
    colProps: { span: 24 },
    component: 'Input'
  },
  {
    field: 'description',
    label: t('depForm.description'),
    colProps: { span: 24 },
    component: 'Input',
    componentProps: {
      type: 'textarea',
      rows: 1
    }
  }
])
